package lanQiaoBei.动态规划.线性dp;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
//https://www.likecs.com/show-307180983.html
public class 最长上升子序列 {
       static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       final static int N=1010;
       static int f[]=new int[N],a[]=new int[N],n;
       
       public static void main(String[] ss) throws IOException {
		      n=Integer.parseInt(br.readLine());
		      ss=br.readLine().split(" ");
		      for(int i=0;i<n;i++)
		    	  a[i]=Integer.parseInt(ss[i]);
		      f[0]=1;
		      for(int i=1;i<n;i++){
		    	  f[i]=1;
		    	  for(int j=0;j<i;j++)
		    		  if(a[i]>a[j])
		    			  f[i]=Math.max(f[i], f[j]+1);
		      }
		      int max=-0x3f3f3f3f;
		      for(int i=0;i<n;i++)
		    	  max=Math.max(f[i], max);
		      System.out.print(max);
	}
}
